import 'package:flutter/material.dart';

class PageViewBuilder extends StatefulWidget {
  const PageViewBuilder({super.key});

  @override
  State<PageViewBuilder> createState() => _PageViewBuilderState();
}

class _PageViewBuilderState extends State<PageViewBuilder> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text("PageViewBuilder")),
      body: PageView.builder(
        itemCount: 10,
        itemBuilder: (context, index) {
          return Center(
            child: PageView(
              scrollDirection: Axis.vertical, // 滑动方向，默认水平方向
              children: [
                Center(
                  child: Text(
                    "第${index}屏",
                    style: Theme.of(context).textTheme.displayLarge,
                  ),
                ),
              ],
            ),
          );
        },
      ),
    );
  }
}
